package learn.design.patterns.E_Builder.BuilderWithoutDirector;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

//无导演者建造者模式（Builder Without Director）
@Getter
@NoArgsConstructor
@AllArgsConstructor
public class WithoutDirectorComputer {
    private String processor;
    private String ram;
    private String hardDrive;

    @Setter
    @NoArgsConstructor
    public class ComputerBuilder {
        private String processor;
        private String ram;
        private String hardDrive;

        public ComputerBuilder withProcessor(String processor) {
            this.processor = processor;
            return this;
        }

        public ComputerBuilder withRam(String ram) {
            this.ram = ram;
            return this;
        }

        public ComputerBuilder withHardDrive(String hardDrive) {
            this.hardDrive = hardDrive;
            return this;
        }

        public WithoutDirectorComputer build() {
            return new WithoutDirectorComputer(processor, ram, hardDrive);
        }
    }
}
